package com.yzd.learnjava.enumerated;

import java.util.Random;

import com.yzd.learnjava.util.Generator;
import com.yzd.learnjava.util.Print;

public class EnumImplemention {
	public static <T> void printNext(Generator<T> rg) {
		Print.print(rg.next() + ", ");
	}
	
	public static void main(String[] args) {
		CartoonCharacter cc = CartoonCharacter.BOB;
		for(int i = 0 ; i < 10; i++) {
			printNext(cc);
		}
	}
}

enum CartoonCharacter implements Generator<CartoonCharacter> {
	SLAPPY, SPANKY, PUNCHY, SILLY, BOUNCE, NUTTY, BOB;
	
	private Random random = new Random(47);
	public CartoonCharacter next() {
		return values()[random.nextInt(values().length)];
	}
}
